package com.oig.sys.msg.dao;

import com.oig.sys.msg.entity.TbTask;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.Date;

/**
@author wuxl
*/
public interface ITbTaskDao extends JpaRepository<TbTask, Integer> {

	@Query("from TbTask t where t.id=:id")
	TbTask getTaskById(@Param("id") Integer id);


	@Query("select count(t) from TbTask t where t.dealId=:dealId and t.status in('00','01')")
	Integer countUndoByDealId(@Param("dealId") Integer dealId);

	@Query("select count(t) from TbTask t where t.dealId=:dealId and t.status in('03','04') and t.finishTime>=:finishTime")
	Integer countFinishTaskSizeByUserId(@Param("dealId") Integer dealId, @Param("finishTime") Date finishTime);

}
